home *** CD-ROM | disk | FTP | other *** search
/ The Atari Compendium / The Atari Compendium (Toad Computers) (1994).iso / files / prgtools / mint / mgr / sparcmgr / src.zoo / src / move_box.c < prev    next >
Encoding:
C/C++ Source or Header  |  1989-03-17  |  1.4 KB  |  45 lines

  1. /*                        Copyright (c) 1987 Bellcore
  2.  *                            All Rights Reserved
  3.  *       Permission is granted to copy or use this program, EXCEPT that it
  4.  *       may not be sold for profit, the copyright notice must be reproduced
  5.  *       on copies, and credit should be given to Bellcore where it is due.
  6.  *       BELLCORE MAKES NO WARRANTY AND ACCEPTS NO LIABILITY FOR THIS PROGRAM.
  7.  */
  8. /*    $Header: move_box.c,v 1.1 89/03/17 08:21:17 sau Exp $
  9.     $Source: /m1/mgr.new/src/RCS/move_box.c,v $
  10. */
  11. static char    RCSid_[] = "$Source: /m1/mgr.new/src/RCS/move_box.c,v $$Revision: 1.1 $";
  12.  
  13. /* drag a box around the screen */
  14.  
  15. #include "bitmap.h"
  16. #include "defs.h"
  17.  
  18. move_box(screen,mouse,x,y,dx,dy,how)
  19. BITMAP *screen;            /* where to sweep out the box */
  20. int mouse;            /* file to get mouse coords from */
  21. register int *x,*y;        /* starting position */
  22. register int dx,dy;             /* box size */
  23. int how;                    /* termination condition */
  24.    {
  25.    int x_mouse, y_mouse;
  26.    register int button, skip=1;
  27.  
  28.    box(screen,*x,*y,dx,dy);
  29.    do {
  30.       button=mouse_get(mouse,&x_mouse,&y_mouse);
  31.       if (skip)
  32.          box(screen,*x,*y,dx,dy);
  33.       *x += x_mouse;
  34.       *y -= y_mouse;
  35.       *x = BETWEEN(0,*x,BIT_WIDE(screen)-dx);
  36.       *y = BETWEEN(0,*y,BIT_HIGH(screen)-dy);
  37.       if (skip = !mouse_count())
  38.          box(screen,*x,*y,dx,dy);
  39.       }
  40.     while (how ? button!=0 : button==0); 
  41.  
  42.    if (skip)
  43.       box(screen,*x,*y,dx,dy);
  44.    }
  45.